package com.mrjy.maintain.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mrjy.common.entity.UserInfo;
import com.mrjy.common.util.GlobalConstant;
import com.mrjy.maintain.bo.IMenuInfoBo;

@Controller
@RequestMapping("maintain/menuInfo")
public class MenuInfoController {
	@Resource
	private IMenuInfoBo menuInfoBo;	
	
	/**
	 * 根据角色ID查询菜单
	 * @return
	 */
	@RequestMapping("/roleMenu")
	@ResponseBody
	public Object roleMenu(HttpSession session) {
		UserInfo userInfo = ((UserInfo)session.getAttribute(GlobalConstant.USER_INFO));
		return menuInfoBo.queryMenuByRoleId(userInfo);
	}
	
	/**
	 * @author Javin
	 * @date 2017年8月31日
	 * @desc 根据菜单URL查询菜单信息
	 * @param menuUrl
	 * @return
	 */
	public Object queryByMenuUrl(String menuUrl){
		return menuInfoBo.queryByMenuUrl(menuUrl);
	}
	
	/**
	 * 查询所有权限
	 * @return
	 */
	@RequestMapping("/queryAllMenu")
	@ResponseBody
	public Object queryAllMenu(){
		return menuInfoBo.queryAllMenu();
	}

}
